package com.buddies.lottery.utils;

import android.content.Context;
import android.text.TextUtils;

import com.buddies.lottery.App;
import com.buddies.lottery.common.Constants;
import com.buddies.lottery.data.bean.Lottery;
import com.buddies.lottery.ui.MainActivity;
import com.buddies.lottery.ui.lottery.bet.LotteryBetRecordActivity;
import com.buddies.lottery.ui.lottery.detail.LotteryDetailActivity;
import com.buddies.lottery.ui.pay.PayActivity;
import com.buddies.lottery.ui.web.WebActivity;

public class RedirectUtils {

    public static void redirect(String redirectType, String redirectId) {
        Context context = App.getInstance().getContext();
        if (TextUtils.equals(redirectType, Constants.RedirectType.TYPE_MAIN)) {
            MainActivity.launch(context, redirectId);
        } else if (TextUtils.equals(redirectType, Constants.RedirectType.TYPE_WEB)) {
            WebActivity.launch(context, redirectId);
        } else if (TextUtils.equals(redirectType, Constants.RedirectType.TYPE_PAY)) {
            PayActivity.launch(context);
        } else if (TextUtils.equals(redirectType, Constants.RedirectType.TYPE_MESSAGE_CENTER)) {
//            PayActivity.launch(context);
        } else if (TextUtils.equals(redirectType, Constants.RedirectType.TYPE_LOTTERY)) {
            Lottery lottery = new Lottery();
            lottery.id = Integer.parseInt(redirectId);
            LotteryDetailActivity.launch(context, lottery);
        } else if (TextUtils.equals(redirectType, Constants.RedirectType.TYPE_BET)) {
            LotteryBetRecordActivity.launch(context);
        } else if (TextUtils.equals(redirectType, Constants.RedirectType.TYPE_CUSTOMER_SERVICE)) {
            WebActivity.launch(context, redirectId);
        }
    }

}
